import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LegalDocumentVo, LegalDocumentForm, LegalDocumentQuery } from '@/api/legaldocument/types';

/**
 * 查询用户协议列表
 * @param query
 * @returns {*}
 */

export const listLegalDocument = (query?: LegalDocumentQuery): AxiosPromise<LegalDocumentVo[]> => {
  return request({
    url: '/lawyer/doc/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户协议详细
 * @param id
 */
export const getLegalDocument = (id: string | number): AxiosPromise<LegalDocumentVo> => {
  return request({
    url: '/lawyer/doc/' + id,
    method: 'get'
  });
};

/**
 * 新增用户协议
 * @param data
 */
export const addLegalDocument = (data: LegalDocumentForm) => {
  return request({
    url: '/lawyer/doc/saveDoc',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户协议
 * @param data
 */
export const updateLegalDocument = (data: LegalDocumentForm) => {
  return request({
    url: '/lawyer/doc/updateDoc',
    method: 'post',
    data: data
  });
};

/**
 * 删除用户协议
 * @param id
 */
export const delLegalDocument = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lawyer/doc/removeDoc/' + id,
    method: 'delete'
  });
};
